#include "connect_handler.h"
#include "event2/event.h"
#include "spdlog/spdlog.h"
#include "connecter.h"

ConnectHandler::ConnectHandler(event_base *evbase, Connecter *connecter)
    : LibEventHandler(evbase), connecter_(connecter)
{
}

void ConnectHandler::onConnected(AMQP::TcpConnection *connection)
{
}

void ConnectHandler::onHeartbeat(AMQP::TcpConnection *connection)
{
    connection->heartbeat();
}

void ConnectHandler::onLost(AMQP::TcpConnection *connection)
{
    connecter_->reconnect();
}

void ConnectHandler::onError(AMQP::TcpConnection *connection, const char *message)
{
    connecter_->reconnect();
}
